<link type="text/css" href="/admins/js/pagerView/pager-view.css" rel="stylesheet" />
<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/admins/js/jquery/jquery-ui-1.8.20.custom.min.js"></script>
<script type="text/javascript" src="/admins/js/jquery/jquery.ui.datepicker-zh-CN.js"></script>
<script type="text/javascript" src="/admins/js/pagerView/pager-view.js"></script>
<style>
    #billboy{
        font-size: 14px;
        width: 98%;
        float: left;
    }
    #useredit{
        padding-left: 20px;
        padding-bottom: 10px;
        float: left;
    }
    #bf{
        background-color: #eee;
        text-align: right;
        width: 120px;
        line-height: 48px;
    }
    #cf{
        width: 230px;
    }
</style>
<?php
if($this->ma == 1){
    echo '<script language="javascript" type="text/javascript">alert("添加成功！");location.href = "/admini/manageadmin/index/"; </script>';
}else if($this->ma == 2){
    echo '<script language="javascript" type="text/javascript">alert("登录名已存在！");</script>';
}
?>
<div id='billboy'>
    <div id='useredit' >
        <form method="post" action="/admini/manageadmin/adduser/" id="formstore">
        添加后台用户信息
        <table width="920" border="1" cellpadding="0" cellspacing="0">
            <tr>
              <td id='bf'>登录名：</td>
              <td id='cf'>&nbsp;&nbsp;<input type="text" id="loginname" name="loginname" value="" /></td>
              <td id='bf'>真实姓名：</td>
              <td id='cf'>&nbsp;&nbsp;<input type="text" id="nikename" name="nikename" value="" /></td>
            </tr>
            <tr>
              <td id='bf'>密码：</td>
              <td id='cf'>&nbsp;&nbsp;<input type="text" id="password" name="password" value="" size="50"/></td>
              <td id='bf'>权限：</td>
              <td id='cf'>&nbsp;&nbsp;<select id="roleid" name="roleid">
                      <option value="1" >超级管理员</option>
                      <option value="2" >管理员</option>
                      <option value="3" >客服</option>
                      <option value="100" >代理客户</option>
                  </select></td>
            </tr>
            <tr>
              <td id='bf'>操作：</td>
              <td id='cf'  colspan="3">
                    <input type="hidden" id="operate" name="operate" value="addadminuser" />
                    <a href="javascript:history.go(-1);" class="anvbotton4" id="reto" style="margin-left:20px;"><span>返回</span></a>
                    <a class="anvbotton" href="javascript:void(0)" id="submit_button" style="margin-left:20px;"><span>提交</span></a></td>
            </tr>
        </table>
        </form>
    </div>
</div>
<script language='javascript'>
    
    $("#submit_button").click(function(){
        var loginname = $('#loginname').val();
        var password = $('#password').val();
        if(loginname == ""){
            alert("登录名称不能为空！");
            return false;
        }else if(password == ""){
            alert("登录密码不能为空！");
            return false;
        }else{
            $("#formstore").submit();
        }
    });
    $("#loginname").blur(function(){
       var loginname = $(this).val();
        $.ajax({
                type: 'POST',
                url: '/admini/manageadmin/byloginname'+"/loginname/"+loginname,
                success: function(data) {
                    if(data == 1){
                        alert("该登录名已存在！");
                        $("#loginname").val('');
                    }
                }
            });
        return false;
    });
</script>